<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script>

var contextPath='${contextPath}';
var add_play = function(){
	window.location.href=encodeURI("${contextPath}/index/consultant_apply_add.htm")
}

var id="";
function selectAll(){  
   var checklist = document.getElementsByName ("delete");  
   if(document.getElementById("selectAll").checked)  {  
      	for(var i=0;i<checklist.length;i++){  
      		checklist[i].checked = 1;  
        if(i == checklist.length-1){  
           id = id + checklist[i].value;  
         }else{  
           id = id + checklist[i].value + ',';  
         }  
       }   
  }else{  
     for(var j=0;j<checklist.length;j++){  
      	checklist[j].checked = 0;  
    }  
                id = "";  
 }  
}  


var down = function(id){
	$.post('${contextPath}/index/updateIsxiazai.json',{id:id},function(data){
		if(data){
			if(data.msg=="1"){
				$("#"+id).html("已下载");
			}
		}
	});
}


function delTeacher(){  
	var data = {};
	var cs = [];
	$( "#container" ).find("table:last").find( "tr" ).each( function( id )
	{
		var detes = $(this).find("td.dele").find('.deletes:checked').val();
		if(detes!=null && detes!=""){
			cs.push(detes);
		}
	} );
	
	cs = cs.join( "," );
	data.clients = cs;
	if(data.clients =="" || data.clients == null){
		alert("请选择要删除的客户。");
		return;
	}
	var url="${contextPath}/index/delete_apply.json"
	$.post(url , data, 
	function(ms){
		if(ms.msg=="1"){
			alert("删除成功！");
		}else if(ms.msg=="0"){
			alert("删除失败，已上传数据不可删除！");
		}
		window.location.href=encodeURI(contextPath+"/index/plan_apply.htm");
	}, "json" );
}

function starquery(){
	var stu_name = $("#client").val();
	var check = $("#sources").val();
	window.location.href=encodeURI("${contextPath}/index/plan_apply.htm?stu_name="+stu_name+"&check="+check);
	
}




$(function(){
	$("#sources").val('<#if ischeck!=null && ischeck!=''>${ischeck}</#if>');
})
</script>
</head>
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>工作管理</li>
			<li>&gt;</li>
			<li class="current">训练方案查看</li>
		</ul>
	</div>
	<div id="container">
		<div id="title">训练方案查看</div>
			<table class="simple_table" rel="" style="">
			<tr>
				<td>
				<div style="overflow: hidden;">
				<input type="text" id="client" size="15" placeholder="学生姓名" value="<#if stu_name!=null && stu_name!=''>${stu_name}</#if>" />&nbsp;&nbsp;
				<label for="phone">审核状态：</label> 
				<select id="sources">
				<option value="">不限</option>
				<option value='是'>是</option>
				<option value='否' title=''>否</option>
				</select>&nbsp;&nbsp;
				<label for="phone">训练类型：</label>
				<select id="worth">
					<option value="">-- 不限 --</option>
	 				<option value="1">中心非脑电</option>
					<option value="2">中心普通</option>
					<option value="3">中心全脑</option>
					<option value="4">上门普通</option>
					<option value="5">上门全脑</option>
					<option value="6">上门非脑电</option>
				</select>&nbsp;&nbsp;
				 <input type="button" value=" 查 询 " onclick="starquery()" />
				<!-- <input type="button" value=" 申请训练方案 " onclick="add_play()" /> -->
				<input type="button" value=" 删除训练方案" onclick="delTeacher()" />
				</div>
               </td>
              <td style="">
             
				</td>
			</tr>
		</table>
		<table>
			<tr class="fields">
				<th><input type="checkbox" onclick="selectAll()"  name="selectAll" id="selectAll" value=""></th>
				<th>学员</th>
				<th>课程类型</th>
				<th>学员情况</th>
				<th>审核</th>
				<th>使用时间</th>
				<th>操作</th>
			</tr>
				<#list list as practice>
				<input type="hidden" id="tea_id" value="${practice.tea_id}">
				<tr bgcolor="#f8f8f8">
					<td align="center" class="dele"><input type="checkbox" name="delete" class="deletes" value="${practice.id}" /></td>
					<td align="center">${practice.stu_name}</td>
					<td align="center">${practice.course_type}</td>
					<td align="center" title="${practice.student_msg}"><#if practice.student_msg?length gt 8>${practice.student_msg?substring(0,7)}...<#else>${practice.student_msg}</#if></td>
					<td align="center" >${practice.ischeck}</td>
					<td align="center" >${practice.useful_time?date}</td>
					<td align="center">
					<#if practice.url!='null' && practice.url!="">
						<#if practice.oname!=null && practice.oname!="">
							<#if practice.is_xiazai=="0">	
								<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.oname}" id ="${practice.id}" onclick="down(${practice.id})" name="down">下载</a>
							<#else>
								<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.oname}">已下载</a>
							</#if>
						<#else>
							<#if practice.url?substring(practice.url?length-3,practice.url?length)=="rar">
								<#if practice.is_xiazai=="0">	
									<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.stu_name}${practice.useful_time?date}.rar" id ="${practice.id}" onclick="down(${practice.id})" name="down">下载</a>
								<#else>
									<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.stu_name}${practice.useful_time?date}.rar">已下载</a>
								</#if>
							<#elseif practice.url?substring(practice.url?length-3,practice.url?length)=="zip">
								<#if practice.is_xiazai=="0">	
									<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.stu_name}${practice.useful_time?date}.zip" id ="${practice.id}" onclick="down(${practice.id})" name="down">下载</a>
								<#else>
									<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.stu_name}${practice.useful_time?date}.zip">已下载</a>
								</#if>
							<#else>
								<#if practice.is_xiazai=="0">	
									<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.stu_name}${practice.useful_time?date}.doc" id ="${practice.id}" onclick="down(${practice.id})" name="down">下载</a>
								<#else>
									<a class="tosnmiddle_btn xun" href="http://www.yueqiao.org${practice.url}" download="${practice.stu_name}${practice.useful_time?date}.doc">已下载</a>
								</#if>
							</#if>
						</#if>
					<#else>
						<a class="tosnmiddle_btn xun">未上传</a>
						&nbsp;<a href="${contextPath}/index/consultant_apply_add.htm?practiceid=${practice.id}" class="tosnmiddle_btn xun">编辑</a>
					</#if>
					</td>
				</tr>
				</#list>
		</table>
	</div>
	<div id="pager">
		<ul id="pagination">
			<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
				<#if currpage==1 >
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/index/plan_apply.htm?currPage=${currpage-1}&center=${centName}&nickName=${nickName}">上一页</a></li>
					</#if>
					
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/plan_apply.htm?currPage=${index_up}&center=${centName}&nickName=${nickName}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/plan_apply.htm?currPage=${index_up}&center=${centName}&nickName=${nickName}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/plan_apply.htm?currPage=${pagetotal}&center=${centName}&nickName=${nickName}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/plan_apply.htm?currPage=1&center=${centName}&nickName=${nickName}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/plan_apply.htm?currPage=${index_up}&center=${centName}&nickName=${nickName}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/plan_apply.htm?currPage=${pagetotal}&center=${centName}&nickName=${nickName}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/index/plan_apply.htm?currPage=1&center=${centName}&nickName=${nickName}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/plan_apply.htm?currPage=${index_up}&center=${centName}&nickName=${nickName}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/plan_apply.htm?currPage=${currpage+1}&center=${centName}&nickName=${nickName}">下一页</a></li>
		</#if>
		<li class="pageinfo">共${page.total}条记录</li>
	</#if>
		</ul>
	</div>
	<div class="emptyline"></div>
</body>
</html>